package main

import (
	"fmt"
	"strconv"
)

//#link: https://leetcode-cn.com/problems/palindrome-number/
func main() {
	x := 121
	fmt.Println(isPalindrome(x))

}
func isPalindrome(x int) bool {
	num, tmp := 0, x
	for tmp > 0 {
		num = num*10 + tmp%10
		tmp /= 10
	}
	return num == x
}

func isPalindromeToNum(x int) bool {
	xStr := strconv.Itoa(x)
	for i := 0; i < len(xStr)>>1; i++ {
		if xStr[i] != xStr[len(xStr)-i-1] {
			return false
		}
	}
	return true
}
